﻿@model projectManagementWeb.Models.TaskDescriptionModel2
           
@{
    ViewBag.Title = "CreateTask";
}

<div align="right">
    @Html.ActionLink("<< Regresar", "Index")
</div>

@if (ViewBag.projectID != 0)
{ 
<h2>Nueva tarea</h2>
    
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<style type="text/css">
.ui-datepicker { width: 17em; padding: .2em .2em 0; background: #66FF99;}
</style>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $(".date").datepicker
            ({
                dateFormat: 'mm/dd/yy',
                
                showStatus: true,
                showWeeks: true,
                highlightWeek: true,
                numberOfMonths: 1,
                showAnim: "scale",
                showOptions: {
                    origin: ["top", "left"]
                }
            });
    });
</script>



using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        @Html.HiddenFor(model => model.ProjectID)
        @Html.HiddenFor(model => model.userID)
        <legend>Tarea</legend>

        <div class="editor-label">
            Nombre:
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.TaskName)
            @Html.ValidationMessageFor(model => model.TaskName)
        </div>

        <div class="editor-label">
            Descripcion:
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.TaskDescription)
            @Html.ValidationMessageFor(model => model.TaskDescription)
        </div>
        <div class="editor-label">
            Módulo:
        </div>
        <div class="editor-field">
           
            @Html.DropDownListFor(model => model.ModuleID, new SelectList(Model.ModuleList, "Value", "Text", Model.ModuleID))
            @Html.ValidationMessageFor(model => model.ModuleID)
        </div>

       <div class="editor-label">
            Valor planeado:
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.PlannedEstimate)
            @Html.ValidationMessageFor(model => model.PlannedEstimate)
        </div>
        <div class="editor-label">
            Estado actual:
        </div>
        <div class="editor-label">
           No Iniciado
        </div>
        <div class="editor-label">
            Fecha de inicio:
        </div>
        <div class="editor-field">
            @if (Model == null)
            {
                @Html.TextBox("StartDate", (DateTime.Now.ToShortDateString()), new { @class = "date" })
            }
            else
            {
                @Html.TextBox("StartDate", Model.StartDate.ToShortDateString(), new { @class = "date" })
            }
            
            @Html.ValidationMessageFor(model => model.StartDate)
        </div>
        <div class="editor-label">
            Fecha de finalización:
        </div>
        <div class="editor-field">

                @if (Model == null)
                {
                    @Html.TextBox("EndDate", (DateTime.Now.ToShortDateString()), new { @class = "date" })
                }
                else
                {
                    @Html.TextBox("EndDate", Model.EndDate.ToShortDateString(), new { @class = "date" })
                }
            @Html.ValidationMessageFor(model => model.EndDate)
        </div>

        <p>
            <input type="submit" value="Guardar" />
        </p>
    </fieldset>
}

}
else { 
    <h2>
        El usuario no tiene proyectos asignados. 
    </h2>
}


